package cn.chencaiju.day01;

import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Properties;

import javax.sql.DataSource;

import org.junit.Before;
import org.junit.Test;

import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;

public class HikariTest {
	HikariDataSource hs=null;
	@Before public void initlized() throws IOException {
		HikariConfig config = new HikariConfig("/hikari.properties");
		hs=new HikariDataSource(config);
	}
	@Test public void testHikari() throws SQLException {

		Connection connection = hs.getConnection();
		PreparedStatement prepareStatement = 
				connection.prepareStatement("select * from teacher where tid='1'");
		ResultSet set = prepareStatement.executeQuery();
		if(set.next()) {
			System.out.println(set.getInt(1)+"\t"+set.getString(2));
		}
	}
}
